package com.qd.system.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 数据日志
 *
 * @author sjk
 */
@Getter
@Setter
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("sys_data_log")
public class DataLog extends Model<DataLog> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "log_id", type = IdType.ASSIGN_ID)
    private String logId;
    /**
     * 用户ID
     */
    @TableField("user_id")
    private String userId;
    /**
     * 用户姓名
     */
    @TableField("user_name")
    private String userName;
    /**
     * IP地址
     */
    @TableField("user_ip")
    private String userIp;
    /**
     * 模块标题
     */
    @TableField("title")
    private String title;
    /**
     * 方法名称
     */
    @TableField("method")
    private String method;
    /**
     * 登录类型:电脑端或者手机端
     */
    @TableField("remote")
    private String remote;
    /**
     * 请求方式
     */
    @TableField("request_method")
    private String requestMethod;
    /**
     * 操作类型
     */
    @TableField("operator_type")
    private String operatorType;
    /**
     * 组织机构名称
     */
    @TableField("org_name")
    private String orgName;
    /**
     * 请求URL
     */
    @TableField("url")
    private String url;
    /**
     * 原始sql
     */
    @TableField("raw_sql")
    private String rawSql;
    /**
     * 数据表
     */
    @TableField("table_name")
    private String tableName;
    @TableField(exist = false)
    private transient Object contentObj;
    /**
     * 内容
     */
    @TableField("content")
    private String content;
    /**
     * 历史内容
     */
    @TableField("history_content")
    private String historyContent;
    /**
     * 方法名
     */
    @TableField("dao_method_name")
    private String daoMethodName;
    /**
     * 执行SQL返回值:批量操作有值
     */
    @TableField("sql_return_id")
    private Integer sqlReturnId;
    /**
     * 操作时间
     */
    @TableField("operator_time")
    private LocalDateTime operatorTime;
    /**
     * SQL操作
     */
    @TableField("sql_command_type")
    private String sqlCommandType;
    /**
     * 机构ID
     */
    @TableField("org_id")
    private String orgId;

    public void freeData() {
        this.logId = null;
        this.userId = null;
        this.userName = null;
        this.userIp = null;
        this.title = null;
        this.method = null;
        this.remote = null;
        this.requestMethod = null;
        this.operatorType = null;
        this.orgName = null;
        this.url = null;
        this.rawSql = null;
        this.tableName = null;
        this.content = null;
        this.historyContent = null;
        this.daoMethodName = null;
        this.sqlReturnId = null;
        this.operatorTime = null;
        this.sqlCommandType = null;
        this.orgId = null;
    }

}
